<template>
  <div class="visitdetails">
    <nav>
      <div class="nav_l">
        <span class="navSpan_l" @click="onClickLeft">＜</span>
        <title>拜访详情</title>
      </div>
      <div class="nav_r">
        <van-image round width="6rem" height="6rem" src="https://img.yzcdn.cn/vant/cat.jpeg" />
        <div>
          <ul>
            <li>
              <h3>{{custName}}</h3>
            </li>
            <li>
              <span>录入人:</span>
              {{custName}}
            </li>
          </ul>
        </div>
      </div>
    </nav>
    <div class="details">
      <p>
        <span>
          <img src="../../assets/logo.png" alt />
        </span>基本信息
      </p>
      <ul>
        <li>
          <div>拜访标题:</div>
          {{visitTitle}}
        </li>
        <li>
          <div>拜访时间:</div>
          {{visitTime}}
        </li>
        <li>
          <div>拜访地址:</div>
          {{visitAddress}}
        </li>
        <li>
          <div>拜访原因:</div>
          {{visitReason}}
        </li>
        <li>
          <div>拜访情况:</div>
          {{visitSituation}}
        </li>
        <li>
          <div>竞争信息收集描述:</div>
          {{collectSituation}}
        </li>
        <li>
          <div>创建时间:</div>
          {{createTime}}
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import { GetVisitDateAPI } from "../../request/api";

export default {
  data() {
    return {
      visitTitle: "", // 拜访标题
      visitTime: "", // 拜访事件
      visitAddress: "", // 拜访地址
      visitReason: "", // 拜访原因
      visitSituation: "", // 拜访情况描述
      collectSituation: "", // 竞争信息收集描述
      createTime: "", // 创建时间
      custName: "" // 客户名字
    };
  },
  methods: {
    onClickLeft() {
      this.$router.back();
    }
  },
  created() {
    GetVisitDateAPI({
      id: this.$route.params.id
    }).then(res => {
      if (res.errCode == 0) {
        let {
          visitTitle,
          visitTime,
          visitAddress,
          visitReason,
          visitSituation,
          collectSituation,
          createTime,
          custName
        } = res.data;
        this.custName = custName;
        this.visitTime = visitTime;
        this.visitTitle = visitTitle;
        this.createTime = createTime;
        this.visitReason = visitReason;
        this.visitAddress = visitAddress;
        this.visitSituation = visitSituation;
        this.collectSituation = collectSituation;
      }
    });
  }
};
</script>

<style scoped lang="less">
.visitdetails > nav {
  height: 220px;
  background-color: #1989fa;
  line-height: 50px;
  margin: 0;
  padding: 0;
  color: #fff;
}
.visitdetails > nav > .nav_l {
  text-align: center;
}
.visitdetails > nav > .nav_l > .navSpan_l {
  float: left;
  font-size: 24px;
}
.visitdetails > nav > .nav_l > title {
  display: inline;
}
.nav_r {
  display: flex;
}
.nav_r > .van-image {
  margin-left: 20px;
}
.nav_r h3 {
  margin: 0;
}
.nav_r li {
  margin-left: 8px;
  height: 40px;
}

.visitdetails {
  position: relative;
  height: 800px;
}

.details {
  width: 86%;
  height: 81%;
  top: 140px;
  margin: 3%;
  background-color: #fff;
  position: absolute;
  border-radius: 10px;
  padding: 0 4%;
}
.details img {
  width: 18px;
  height: 18px;
  margin-right: 5px;
}
.details p {
  height: 40px;
  line-height: 40px;
  font-size: 18px;
  border-bottom: 1px solid #ccc;
  width: 90%;
  overflow: hidden;
}
.details li {
  margin: 8px 0;
  display: flex;
  align-items: center;
}
.details li div {
  color: #ccc;
  width: 69px;
  display: inline-block;
  text-align: justify;
  text-justify: newspaper;
  word-break: break-all;
  margin-right: 5px;
}
</style>